//
//  ScreeningViewController.m
//  GXWN
//
//  Created by iMacOne on 15/11/5.
//  Copyright © 2015年 UNOHACHA. All rights reserved.
//

#import "ScreeningViewController.h"
#import "Size.h"
#import "ToolUtil.h"
#import<QuartzCore/QuartzCore.h>
#import "CheckBox.h"
@interface ScreeningViewController (){
    UITextField *bigTextF;
    UITextField *smallTextF;
}

@end

@implementation ScreeningViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.title = @"筛选";
    //self.navigationController.navigationBar.hidden = YES;
    self.view.backgroundColor = [UIColor whiteColor];
    //[self createTitle:@"lalalala" midTitle:@"hagjkja"];
    // Do any additional setup after loading the view.
    
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemReply target:self action:@selector(back)];
    
    UILabel *totalPriceLabel = [[UILabel alloc] initWithFrame:CGRectMake(WindowWidth / 24 , 10 * Height + 64, WindowWidth / 24 *3, 30*Height)];
    totalPriceLabel.text = @"总价";
    totalPriceLabel.tintColor = [UIColor cyanColor];
    //totalPriceLabel.font = FONT(12);
    [self.view addSubview:totalPriceLabel];
    
    smallTextF = [[UITextField alloc] initWithFrame:CGRectMake(WindowWidth / 6, 10 * Height + 64, WindowWidth / 4, 30*Height)];
    
    smallTextF.placeholder = @"￥";
    [self.view addSubview:smallTextF];
    [ToolUtil createLine:20 * Height + 64 +21*Height superView:self.view lift:WindowWidth / 6 width:WindowWidth / 4 hight:0.5 color:[UIColor colorWithRed:229/255. green:229/255. blue:229/255. alpha:1.0]];
    [ToolUtil createLine:20 * Height + 64 +21*Height superView:self.view lift:WindowWidth / 3 + WindowWidth / 4 width:WindowWidth / 4 hight:0.5 color:[UIColor colorWithRed:229/255. green:229/255. blue:229/255. alpha:1.0]];
    [ToolUtil createLine:30 * Height + 64 +21*Height superView:self.view lift:0 width:WindowWidth hight:5 color:[UIColor colorWithRed:229/255. green:229/255. blue:229/255. alpha:1.0]];
    
    UILabel *middleLabel = [[UILabel alloc] initWithFrame:CGRectMake(WindowWidth / 6 + WindowWidth / 4, 10 * Height+ 64, WindowWidth / 6, 30*Height)];
    middleLabel.text = @"万 --";
    [self.view addSubview:middleLabel];
    
    bigTextF = [[UITextField alloc] initWithFrame:CGRectMake(WindowWidth / 3 + WindowWidth / 4, 10 * Height+ 64, WindowWidth / 4, 30*Height)];
    
    bigTextF.placeholder = @"￥";
    [self.view addSubview:bigTextF];
    
    UILabel *lastLabel = [[UILabel alloc] initWithFrame:CGRectMake(WindowWidth / 3 + WindowWidth / 2, 10 * Height+ 64, WindowWidth / 6, 30*Height)];
    lastLabel.text = @"万";
    [self.view addSubview:lastLabel];
    
    UILabel *typeLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 60 *Height + 64, WindowWidth / 3, 30 * Height)];
    typeLabel.text = @"房源类型";
    typeLabel.backgroundColor = [UIColor redColor];
    typeLabel.textColor = [UIColor whiteColor];
    typeLabel.layer.cornerRadius = 12.0;
    typeLabel.textAlignment = 1;
    typeLabel.layer.masksToBounds = YES;
    typeLabel.clipsToBounds = YES;
    [self.view addSubview:typeLabel];
    
    CheckBox *apartmentButton = [[CheckBox alloc] initWithParent:self.view point:CGPointMake(30*Width, 95 *Height +64) callback:^(NSMutableDictionary *dic) {
        NSLog(@"------------");
    } text:@"公寓" checked:NO];
    
    CheckBox *villaButton = [[CheckBox alloc] initWithParent:self.view point:CGPointMake(140*Width, 95 *Height +64) callback:^(NSMutableDictionary *dic) {
        NSLog(@"------------");
    } text:@"别墅" checked:NO];
    
    CheckBox *serviceApartmentButton = [[CheckBox alloc] initWithParent:self.view point:CGPointMake(250*Width, 95 *Height +64) callback:^(NSMutableDictionary *dic) {
        NSLog(@"------------");
    } text:@"酒店公寓" checked:NO];
    
    CheckBox *buildingButton = [[CheckBox alloc] initWithParent:self.view point:CGPointMake(30*Width, 125 *Height +64) callback:^(NSMutableDictionary *dic) {
        NSLog(@"------------");
    } text:@"写字楼" checked:NO];
    
    [ToolUtil createLine: 155 *Height +64 superView:self.view lift:0 width:WindowWidth hight:2 color:[UIColor colorWithRed:229/255. green:229/255. blue:229/255. alpha:1.0]];
    
    UILabel *stateLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 160 *Height + 64, WindowWidth / 3, 30 * Height)];
    stateLabel.text = @"房源状态";
    stateLabel.backgroundColor = [UIColor redColor];
    stateLabel.textColor = [UIColor whiteColor];
    stateLabel.layer.cornerRadius = 12.0;
    stateLabel.textAlignment = 1;
    stateLabel.layer.masksToBounds = YES;
    stateLabel.clipsToBounds = YES;
    [self.view addSubview:stateLabel];
    
    CheckBox *propertyButton = [[CheckBox alloc] initWithParent:self.view point:CGPointMake(30*Width, 200 *Height +64) callback:^(NSMutableDictionary *dic) {
        NSLog(@"------------");
    } text:@"期房" checked:NO];
    CheckBox *readyButton = [[CheckBox alloc] initWithParent:self.view point:CGPointMake(140*Width, 200 *Height +64) callback:^(NSMutableDictionary *dic) {
        NSLog(@"------------");
    } text:@"现房" checked:NO];
    
    [ToolUtil createLine: 230 *Height +64 superView:self.view lift:0 width:WindowWidth hight:2 color:[UIColor colorWithRed:229/255. green:229/255. blue:229/255. alpha:1.0]];
    
    
    UILabel *wayLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 235 *Height + 64, WindowWidth / 3, 30 * Height)];
    wayLabel.text = @"结佣方式";
    wayLabel.backgroundColor = [UIColor redColor];
    wayLabel.textColor = [UIColor whiteColor];
    wayLabel.layer.cornerRadius = 12.0;
    wayLabel.textAlignment = 1;
    wayLabel.layer.masksToBounds = YES;
    wayLabel.clipsToBounds = YES;
    [self.view addSubview:wayLabel];
    
    CheckBox *onceButton = [[CheckBox alloc] initWithParent:self.view point:CGPointMake(30*Width, 275 *Height +64) callback:^(NSMutableDictionary *dic) {
        NSLog(@"------------");
    } text:@"一次结佣" checked:NO];
    
    CheckBox *twiceButton = [[CheckBox alloc] initWithParent:self.view point:CGPointMake(140*Width, 275 *Height +64) callback:^(NSMutableDictionary *dic) {
        NSLog(@"------------");
    } text:@"二次结佣" checked:NO];
    
    [ToolUtil createLine: 305 *Height +64 superView:self.view lift:0 width:WindowWidth hight:2 color:[UIColor colorWithRed:229/255. green:229/255. blue:229/255. alpha:1.0]];
    
    UILabel *sellPointLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 310 *Height + 64, WindowWidth / 3, 30 * Height)];
    sellPointLabel.text = @"卖点";
    sellPointLabel.backgroundColor = [UIColor redColor];
    sellPointLabel.textColor = [UIColor whiteColor];
    sellPointLabel.layer.cornerRadius = 12.0;
    sellPointLabel.textAlignment = 1;
    sellPointLabel.layer.masksToBounds = YES;
    sellPointLabel.clipsToBounds = YES;
    [self.view addSubview:sellPointLabel];
    
    CheckBox *schoolButton = [[CheckBox alloc] initWithParent:self.view point:CGPointMake(30*Width, 350 *Height +64) callback:^(NSMutableDictionary *dic) {
        NSLog(@"------------");
    } text:@"学区房" checked:NO];
    CheckBox *migrateButton = [[CheckBox alloc] initWithParent:self.view point:CGPointMake(140*Width, 350 *Height +64) callback:^(NSMutableDictionary *dic) {
        NSLog(@"------------");
    } text:@"可移民" checked:NO];
    
    CheckBox *waterscapeButton = [[CheckBox alloc] initWithParent:self.view point:CGPointMake(250*Width, 350 *Height +64) callback:^(NSMutableDictionary *dic) {
        NSLog(@"------------");
    } text:@"海景房" checked:NO];
    
    CheckBox *downtownButton = [[CheckBox alloc] initWithParent:self.view point:CGPointMake(30*Width, 380 *Height +64) callback:^(NSMutableDictionary *dic) {
        NSLog(@"------------");
    } text:@"市中心公..." checked:NO];
    CheckBox *waterButton = [[CheckBox alloc] initWithParent:self.view point:CGPointMake(140*Width, 380 *Height +64) callback:^(NSMutableDictionary *dic) {
        NSLog(@"------------");
    } text:@"水景" checked:NO];
    CheckBox *loughButton = [[CheckBox alloc] initWithParent:self.view point:CGPointMake(250*Width, 380 *Height +64) callback:^(NSMutableDictionary *dic) {
        NSLog(@"------------");
    } text:@"湖景" checked:NO];
    CheckBox *loughHouseButton = [[CheckBox alloc] initWithParent:self.view point:CGPointMake(30*Width, 410 *Height +64) callback:^(NSMutableDictionary *dic) {
        NSLog(@"------------");
    } text:@"湖景房" checked:NO];
    
    CheckBox *golfButton = [[CheckBox alloc] initWithParent:self.view point:CGPointMake(140*Width, 410 *Height +64) callback:^(NSMutableDictionary *dic) {
        NSLog(@"------------");
    } text:@"高尔夫球场" checked:NO];
    
    CheckBox *topGradeButton = [[CheckBox alloc] initWithParent:self.view point:CGPointMake(250*Width, 410 *Height +64) callback:^(NSMutableDictionary *dic) {
        NSLog(@"------------");
    } text:@"高档别墅房" checked:NO];
    
    CheckBox *belgraviaButton = [[CheckBox alloc] initWithParent:self.view point:CGPointMake(30*Width, 440 *Height +64) callback:^(NSMutableDictionary *dic) {
        NSLog(@"------------");
    } text:@"高档住宅区" checked:NO];
    
    UIView * confirmView = [[UIView alloc] initWithFrame:CGRectMake(0, 470 *Height +64, WindowWidth, 197*Height - 64)];
    confirmView.backgroundColor = [UIColor grayColor];
    UIButton *confirmButton = [UIButton buttonWithType:UIButtonTypeSystem];
    confirmButton.frame = CGRectMake(10*Width, 20*Height, WindowWidth - 20*Width, 50*Height);
    [confirmButton setTitle:@"确定筛选" forState:UIControlStateNormal];
    confirmButton.backgroundColor = [UIColor orangeColor];
    confirmButton.tintColor = [UIColor whiteColor];
    [confirmButton addTarget:self action:@selector(pressconfirmButton) forControlEvents:UIControlEventTouchUpInside];
    [confirmView addSubview:confirmButton];
    
    [self.view addSubview:confirmView];
}

- (void)pressconfirmButton{
    self.tabBarController.tabBar.hidden  = NO;
    [self.navigationController popViewControllerAnimated:YES];
    
}

- (void)back{
    self.tabBarController.tabBar.hidden  = NO;
    [self.navigationController popToRootViewControllerAnimated:YES];
    
}

- (void)viewWillAppear:(BOOL)animated{
    
    self.tabBarController.tabBar.hidden = YES;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
    [smallTextF resignFirstResponder];
    [bigTextF resignFirstResponder];
    
    NSLog(@"0000");
}

/*
 #pragma mark - Navigation
 
 // In a storyboard-based application, you will often want to do a little preparation before navigation
 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
 // Get the new view controller using [segue destinationViewController].
 // Pass the selected object to the new view controller.
 }
 */

@end
